package com.umeng.analytics.pro;

import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Serializable;
import java.nio.ByteBuffer;
import java.util.BitSet;
import java.util.Collections;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class bq implements cg, Serializable, Cloneable {
    static class a extends dp {
        private a() {

        }

        public void a(df arg6, bq arg7) throws cm {
            int v4 = 8;
            int v3 = 11;
            arg6.j();
            while (true) {
                da v0 = arg6.l();
                if (v0.b == 0) {
                    break;
                }

                switch (v0.c) {
                    case 1: {
                        if (v0.b == v3) {
                            arg7.a = arg6.z();
                            arg7.a(true);
                            break;
                        }

                        di.a(arg6, v0.b);
                        break;
                    }
                    case 2: {
                        if (v0.b == v3) {
                            arg7.b = arg6.z();
                            arg7.b(true);
                            break;
                        }

                        di.a(arg6, v0.b);
                        break;
                    }
                    case 3: {
                        if (v0.b == v3) {
                            arg7.c = arg6.z();
                            arg7.c(true);
                            break;
                        }

                        di.a(arg6, v0.b);
                        break;
                    }
                    case 4: {
                        if (v0.b == v4) {
                            arg7.d = arg6.w();
                            arg7.d(true);
                            break;
                        }

                        di.a(arg6, v0.b);
                        break;
                    }
                    case 5: {
                        if (v0.b == v4) {
                            arg7.e = arg6.w();
                            arg7.e(true);
                            break;
                        }

                        di.a(arg6, v0.b);
                        break;
                    }
                    case 6: {
                        if (v0.b == v4) {
                            arg7.f = arg6.w();
                            arg7.f(true);
                            break;
                        }

                        di.a(arg6, v0.b);
                        break;
                    }
                    case 7: {
                        if (v0.b == v3) {
                            arg7.g = arg6.A();
                            arg7.g(true);
                            break;
                        }

                        di.a(arg6, v0.b);
                        break;
                    }
                    case 8: {
                        if (v0.b == v3) {
                            arg7.h = arg6.z();
                            arg7.h(true);
                            break;
                        }

                        di.a(arg6, v0.b);
                        break;
                    }
                    case 9: {
                        if (v0.b == v3) {
                            arg7.i = arg6.z();
                            arg7.i(true);
                            break;
                        }

                        di.a(arg6, v0.b);
                        break;
                    }
                    case 10: {
                        if (v0.b == v4) {
                            arg7.j = arg6.w();
                            arg7.j(true);
                            break;
                        }

                        di.a(arg6, v0.b);
                        break;
                    }
                    default: {
                        di.a(arg6, v0.b);
                        break;
                    }
                }

                label_11:
                arg6.m();
            }

            arg6.k();
            if (!arg7.n()) {
                throw new dg("Required field \'serial_num\' was not found in serialized data! Struct: " + this.toString());
            }

            if (!arg7.r()) {
                throw new dg("Required field \'ts_secs\' was not found in serialized data! Struct: " + this.toString());
            }

            if (!arg7.u()) {
                throw new dg("Required field \'length\' was not found in serialized data! Struct: " + this.toString());
            }

            arg7.I();
        }

        public void a(df arg1, cg arg2) throws cm {
            this.b(arg1, ((bq) arg2));
        }

        public void b(df arg2, bq arg3) throws cm {
            arg3.I();
            arg2.a(bq.J());
            if (arg3.a != null) {
                arg2.a(bq.K());
                arg2.a(arg3.a);
                arg2.c();
            }

            if (arg3.b != null) {
                arg2.a(bq.L());
                arg2.a(arg3.b);
                arg2.c();
            }

            if (arg3.c != null) {
                arg2.a(bq.M());
                arg2.a(arg3.c);
                arg2.c();
            }

            arg2.a(bq.N());
            arg2.a(arg3.d);
            arg2.c();
            arg2.a(bq.O());
            arg2.a(arg3.e);
            arg2.c();
            arg2.a(bq.P());
            arg2.a(arg3.f);
            arg2.c();
            if (arg3.g != null) {
                arg2.a(bq.Q());
                arg2.a(arg3.g);
                arg2.c();
            }

            if (arg3.h != null) {
                arg2.a(bq.R());
                arg2.a(arg3.h);
                arg2.c();
            }

            if (arg3.i != null) {
                arg2.a(bq.S());
                arg2.a(arg3.i);
                arg2.c();
            }

            if (arg3.H()) {
                arg2.a(bq.T());
                arg2.a(arg3.j);
                arg2.c();
            }

            arg2.d();
            arg2.b();
        }

        public void b(df arg1, cg arg2) throws cm {
            this.a(arg1, ((bq) arg2));
        }
    }

    static class b implements do0 {
        private b() {

        }

        public a a() {
            return new a();
        }

        public dn b() {
            return this.a();
        }
    }

    static class c extends dq {
        private c() {

        }

        public void a(df arg3, bq arg4) throws cm {
            ((dl) arg3).a(arg4.a);
            ((dl) arg3).a(arg4.b);
            ((dl) arg3).a(arg4.c);
            ((dl) arg3).a(arg4.d);
            ((dl) arg3).a(arg4.e);
            ((dl) arg3).a(arg4.f);
            ((dl) arg3).a(arg4.g);
            ((dl) arg3).a(arg4.h);
            ((dl) arg3).a(arg4.i);
            BitSet v0 = new BitSet();
            if (arg4.H()) {
                v0.set(0);
            }

            ((dl) arg3).a(v0, 1);
            if (arg4.H()) {
                ((dl) arg3).a(arg4.j);
            }
        }

        public void a(df arg1, cg arg2) throws cm {
            this.a(arg1, ((bq) arg2));
        }

        public void b(df arg4, bq arg5) throws cm {
            arg5.a = ((dl) arg4).z();
            arg5.a(true);
            arg5.b = ((dl) arg4).z();
            arg5.b(true);
            arg5.c = ((dl) arg4).z();
            arg5.c(true);
            arg5.d = ((dl) arg4).w();
            arg5.d(true);
            arg5.e = ((dl) arg4).w();
            arg5.e(true);
            arg5.f = ((dl) arg4).w();
            arg5.f(true);
            arg5.g = ((dl) arg4).A();
            arg5.g(true);
            arg5.h = ((dl) arg4).z();
            arg5.h(true);
            arg5.i = ((dl) arg4).z();
            arg5.i(true);
            if (((dl) arg4).b(1).get(0)) {
                arg5.j = ((dl) arg4).w();
                arg5.j(true);
            }
        }

        public void b(df arg1, cg arg2) throws cm {
            this.b(arg1, ((bq) arg2));
        }
    }

    static class d implements do0 {
        private d() {

        }

        public c a() {
            return new c();
        }

        public dn b() {
            return this.a();
        }
    }

    public enum bq$e implements cn {
        VERSION((short) 1, "version"),
        ADDRESS((short) 2, "address"),
        SIGNATURE((short) 3, "signature"),
        SERIAL_NUM((short) 4, "serial_num"),
        TS_SECS((short) 5, "ts_secs"),
        LENGTH((short) 6, "length"),
        ENTITY((short) 7, "entity"),
        GUID((short) 8, "guid"),
        CHECKSUM((short) 9, "checksum"),
        CODEX((short) 10, "codex");

        private static final Map<String, bq$e> k;
        private final short l;
        private final String m;

        static {
            k = new HashMap();
            Iterator it = EnumSet.allOf(bq$e.class).iterator();
            while (it.hasNext()) {
                bq$e eVar = (bq$e) it.next();
                k.put(eVar.b(), eVar);
            }
        }

        private bq$e(short s, String str) {
            this.l = s;
            this.m = str;
        }

        public static bq$e a(int i) {
            switch (i) {
                case 1:
                    return VERSION;
                case 2:
                    return ADDRESS;
                case 3:
                    return SIGNATURE;
                case 4:
                    return SERIAL_NUM;
                case 5:
                    return TS_SECS;
                case 6:
                    return LENGTH;
                case 7:
                    return ENTITY;
                case 8:
                    return GUID;
                case 9:
                    return CHECKSUM;
                case 10:
                    return CODEX;
                default:
                    return null;
            }
        }

        public static bq$e a(String str) {
            return k.get(str);
        }

        public static bq$e b(int i) {
            bq$e a = a(i);
            if (a != null) {
                return a;
            }
            throw new IllegalArgumentException("Field " + i + " doesn't exist!");
        }

        public final short a() {
            return this.l;
        }

        public final String b() {
            return this.m;
        }
    }


    private static final int A = 2;
    private static final int B = 3;
    private byte C;
    private bq$e[] D;
    public String a;
    public String b;
    public String c;
    public int d;
    public int e;
    public int f;
    public ByteBuffer g;
    public String h;
    public String i;
    public int j;
    public static final Map k;
    private static final long l = 420342210744516016L;
    private static final dk m;
    private static final da n;
    private static final da o;
    private static final da p;
    private static final da q;
    private static final da r;
    private static final da s;
    private static final da t;
    private static final da u;
    private static final da v;
    private static final da w;
    private static final Map<Class<? extends dn>, do0> x;
    private static final int y = 0;
    private static final int z = 1;

    static {
        m = new dk("UMEnvelope");
        n = new da("version", (byte) 11, (short) 1);
        o = new da("address", (byte) 11, (short) 2);
        p = new da("signature", (byte) 11, (short) 3);
        q = new da("serial_num", (byte) 8, (short) 4);
        r = new da("ts_secs", (byte) 8, (short) 5);
        s = new da("length", (byte) 8, (short) 6);
        t = new da("entity", (byte) 11, (short) 7);
        u = new da("guid", (byte) 11, (short) 8);
        v = new da("checksum", (byte) 11, (short) 9);
        w = new da("codex", (byte) 8, (short) 10);
        HashMap v0 = new HashMap();
        x = ((Map) v0);
        ((Map) v0).put(dp.class, new b());
        x.put(dq.class, new d());
        EnumMap v0_1 = new EnumMap(e.class);
        ((Map) v0_1).put(bq$e.VERSION, new cs("version", (byte) 1, new ct((byte) 11)));
        ((Map) v0_1).put(bq$e.ADDRESS, new cs("address", (byte) 1, new ct((byte) 11)));
        ((Map) v0_1).put(bq$e.SIGNATURE, new cs("signature", (byte) 1, new ct((byte) 11)));
        ((Map) v0_1).put(bq$e.SERIAL_NUM, new cs("serial_num", (byte) 1, new ct((byte) 8)));
        ((Map) v0_1).put(bq$e.TS_SECS, new cs("ts_secs", (byte) 1, new ct((byte) 8)));
        ((Map) v0_1).put(bq$e.LENGTH, new cs("length", (byte) 1, new ct((byte) 8)));
        ((Map) v0_1).put(bq$e.ENTITY, new cs("entity", (byte) 1, new ct((byte) 11, true)));
        ((Map) v0_1).put(bq$e.GUID, new cs("guid", (byte) 1, new ct((byte) 11)));
        ((Map) v0_1).put(bq$e.CHECKSUM, new cs("checksum", (byte) 1, new ct((byte) 11)));
        ((Map) v0_1).put(bq$e.CODEX, new cs("codex", (byte) 2, new ct((byte) 8)));
        k = Collections.unmodifiableMap(((Map) v0_1));
        cs.a(bq.class, bq.k);
    }

    public bq() {

        this.C = 0;
        this.D = new bq$e[]{bq$e.CODEX};
    }

    public bq(bq arg4) {

        this.C = 0;
        this.D = new bq$e[]{bq$e.CODEX};
        this.C = arg4.C;
        if (arg4.e()) {
            this.a = arg4.a;
        }

        if (arg4.h()) {
            this.b = arg4.b;
        }

        if (arg4.k()) {
            this.c = arg4.c;
        }

        this.d = arg4.d;
        this.e = arg4.e;
        this.f = arg4.f;
        if (arg4.y()) {
            this.g = ch.d(arg4.g);
        }

        if (arg4.B()) {
            this.h = arg4.h;
        }

        if (arg4.E()) {
            this.i = arg4.i;
        }

        this.j = arg4.j;
    }

    public bq(String arg2, String arg3, String arg4, int arg5, int arg6, int arg7, ByteBuffer arg8, String arg9, String arg10) {
        this();
        this.a = arg2;
        this.b = arg3;
        this.c = arg4;
        this.d = arg5;
        this.d(true);
        this.e = arg6;
        this.e(true);
        this.f = arg7;
        this.f(true);
        this.g = arg8;
        this.h = arg9;
        this.i = arg10;
    }

    public void A() {
        this.h = null;
    }

    public boolean B() {
        boolean v0 = this.h != null ? true : false;
        return v0;
    }

    public String C() {
        return this.i;
    }

    public void D() {
        this.i = null;
    }

    public boolean E() {
        boolean v0 = this.i != null ? true : false;
        return v0;
    }

    public int F() {
        return this.j;
    }

    public void G() {
        this.C = cd.b(this.C, 3);
    }

    public boolean H() {
        return cd.a(this.C, 3);
    }

    public void I() throws cm {
        if (this.a == null) {
            throw new dg("Required field \'version\' was not present! Struct: " + this.toString());
        }

        if (this.b == null) {
            throw new dg("Required field \'address\' was not present! Struct: " + this.toString());
        }

        if (this.c == null) {
            throw new dg("Required field \'signature\' was not present! Struct: " + this.toString());
        }

        if (this.g == null) {
            throw new dg("Required field \'entity\' was not present! Struct: " + this.toString());
        }

        if (this.h == null) {
            throw new dg("Required field \'guid\' was not present! Struct: " + this.toString());
        }

        if (this.i == null) {
            throw new dg("Required field \'checksum\' was not present! Struct: " + this.toString());
        }
    }

    static dk J() {
        return bq.m;
    }

    static da K() {
        return bq.n;
    }

    static da L() {
        return bq.o;
    }

    static da M() {
        return bq.p;
    }

    static da N() {
        return bq.q;
    }

    static da O() {
        return bq.r;
    }

    static da P() {
        return bq.s;
    }

    static da Q() {
        return bq.t;
    }

    static da R() {
        return bq.u;
    }

    static da S() {
        return bq.v;
    }

    static da T() {
        return bq.w;
    }

    public bq a(String arg1) {
        this.a = arg1;
        return this;
    }

    public bq a(int arg2) {
        this.d = arg2;
        this.d(true);
        return this;
    }

    public bq a(byte[] arg2) {
        ByteBuffer v0 = arg2 == null ? null : ByteBuffer.wrap(arg2);
        this.a(v0);
        return this;
    }

    private void a(ObjectInputStream arg3) throws IOException, ClassNotFoundException {
        try {
            this.C = 0;
            this.a(new cz(new dr(((InputStream) arg3))));
            return;
        } catch (cm v0) {
            throw new IOException(v0.getMessage());
        }
    }

    public void a(df arg3) throws cm {
        bq.x.get(arg3.D()).b().b(arg3, ((cg) this));
    }

    private void a(ObjectOutputStream arg3) throws IOException {
        try {
            this.b(new cz(new dr(((OutputStream) arg3))));
            return;
        } catch (cm v0) {
            throw new IOException(v0.getMessage());
        }
    }

    public bq a() {
        return new bq(this);
    }

    public bq a(ByteBuffer arg1) {
        this.g = arg1;
        return this;
    }

    public void a(boolean arg2) {
        if (!arg2) {
            this.a = null;
        }
    }

    public bq b(String arg1) {
        this.b = arg1;
        return this;
    }

    public void b(df arg3) throws cm {
        bq.x.get(arg3.D()).b().a(arg3, ((cg) this));
    }

    public cn b(int arg2) {
        return this.f(arg2);
    }

    public void b() {
        this.a = null;
        this.b = null;
        this.c = null;
        this.d(false);
        this.d = 0;
        this.e(false);
        this.e = 0;
        this.f(false);
        this.f = 0;
        this.g = null;
        this.h = null;
        this.i = null;
        this.j(false);
        this.j = 0;
    }

    public void b(boolean arg2) {
        if (!arg2) {
            this.b = null;
        }
    }

    public bq c(String arg1) {
        this.c = arg1;
        return this;
    }

    public bq c(int arg2) {
        this.e = arg2;
        this.e(true);
        return this;
    }

    public String c() {
        return this.a;
    }

    public void c(boolean arg2) {
        if (!arg2) {
            this.c = null;
        }
    }

    public bq d(int arg2) {
        this.f = arg2;
        this.f(true);
        return this;
    }

    public bq d(String arg1) {
        this.h = arg1;
        return this;
    }

    public void d(boolean arg3) {
        this.C = cd.a(this.C, 0, arg3);
    }

    public void d() {
        this.a = null;
    }

    public bq e(int arg2) {
        this.j = arg2;
        this.j(true);
        return this;
    }

    public bq e(String arg1) {
        this.i = arg1;
        return this;
    }

    public boolean e() {
        boolean v0 = this.a != null ? true : false;
        return v0;
    }

    public void e(boolean arg3) {
        this.C = cd.a(this.C, 1, arg3);
    }

    public void f(boolean arg3) {
        this.C = cd.a(this.C, 2, arg3);
    }

    public bq$e f(int arg2) {
        return bq$e.a(arg2);
    }

    public String f() {
        return this.b;
    }

    public void g() {
        this.b = null;
    }

    public void g(boolean arg2) {
        if (!arg2) {
            this.g = null;
        }
    }

    public boolean h() {
        boolean v0 = this.b != null ? true : false;
        return v0;
    }

    public void h(boolean arg2) {
        if (!arg2) {
            this.h = null;
        }
    }

    public String i() {
        return this.c;
    }

    public void i(boolean arg2) {
        if (!arg2) {
            this.i = null;
        }
    }

    public void j(boolean arg3) {
        this.C = cd.a(this.C, 3, arg3);
    }

    public void j() {
        this.c = null;
    }

    public boolean k() {
        boolean v0 = this.c != null ? true : false;
        return v0;
    }

    public int l() {
        return this.d;
    }

    public void m() {
        this.C = cd.b(this.C, 0);
    }

    public boolean n() {
        return cd.a(this.C, 0);
    }

    public int o() {
        return this.e;
    }

    public cg p() {
        return this.a();
    }

    public void q() {
        this.C = cd.b(this.C, 1);
    }

    public boolean r() {
        return cd.a(this.C, 1);
    }

    public int s() {
        return this.f;
    }

    public void t() {
        this.C = cd.b(this.C, 2);
    }

    public String toString() {
        StringBuilder v0 = new StringBuilder("UMEnvelope(");
        v0.append("version:");
        if (this.a == null) {
            v0.append("null");
        } else {
            v0.append(this.a);
        }

        v0.append(", ");
        v0.append("address:");
        if (this.b == null) {
            v0.append("null");
        } else {
            v0.append(this.b);
        }

        v0.append(", ");
        v0.append("signature:");
        if (this.c == null) {
            v0.append("null");
        } else {
            v0.append(this.c);
        }

        v0.append(", ");
        v0.append("serial_num:");
        v0.append(this.d);
        v0.append(", ");
        v0.append("ts_secs:");
        v0.append(this.e);
        v0.append(", ");
        v0.append("length:");
        v0.append(this.f);
        v0.append(", ");
        v0.append("entity:");
        if (this.g == null) {
            v0.append("null");
        } else {
            ch.a(this.g, v0);
        }

        v0.append(", ");
        v0.append("guid:");
        if (this.h == null) {
            v0.append("null");
        } else {
            v0.append(this.h);
        }

        v0.append(", ");
        v0.append("checksum:");
        if (this.i == null) {
            v0.append("null");
        } else {
            v0.append(this.i);
        }

        if (this.H()) {
            v0.append(", ");
            v0.append("codex:");
            v0.append(this.j);
        }

        v0.append(")");
        return v0.toString();
    }

    public boolean u() {
        return cd.a(this.C, 2);
    }

    public byte[] v() {
        this.a(ch.c(this.g));
        byte[] v0 = this.g == null ? null : this.g.array();
        return v0;
    }

    public ByteBuffer w() {
        return this.g;
    }

    public void x() {
        this.g = null;
    }

    public boolean y() {
        boolean v0 = this.g != null ? true : false;
        return v0;
    }

    public String z() {
        return this.h;
    }
}

